import accessService from '../../services/assess'
import * as types from '../mutation-types'
// initial state
const state = {
  shop: []
}

// getters
const getters = {

}

// actions
const actions = {
  loadShopServer({commit},params) {
    return new Promise((resolve,reject) =>{
      accessService.loadShopList((data) =>{
        commit(types.LOAD_SHOP,data);
        resolve(data);
      });
    })
  }
}

// mutations
const mutations = {
  [types.LOAD_SHOP] (state, data) {
    data.data.forEach(item =>{
      state.shop.push({
        name:item.shopName,
        value:item.sellerId
      })
    });
    // state.shop = data.data;
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
